package com.cqjtu.eecs.mapper;

import com.cqjtu.eecs.entity.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 学生 Mapper 接口
 * </p>
 *
 * @author    
 * @since 2022-03-07
 */

@Mapper
public interface StudentMapper extends BaseMapper<Student> {
    Student  selectStudentByStuCode(String stuCode);
    List<Student> selectStudentByYearAndMajor(Integer year, String majorCode, Integer currPage, Integer pageSize);
    List<Student> getAllStudentCount(Integer grade,String majorCode,Integer ncId,Integer currPage,Integer pageSize);
    Integer getAllStudentCount_sum(Integer grade,String majorCode,Integer ncId);
    Integer getAllStudentCount2(Integer grade,String majorCode);
    List<Student> getAllStudentCount2_domain(Integer grade,String majorCode);

    /**
     * 获取学号id map
     * @param codeList
     * @return
     */
    List<Map<String, Object>> getCodeIdMap(List<String> codeList);

    @Select("select  count(distinct s.sid) \n" +
            "from teach_class_student as tcs, student as s \n" +
            "where tcs.sid = s.sid and s.nc_id = #{ncId} and tcs.score < 60")
    Integer getFlunkNum(Integer ncId);
}
